package com.mapper.sales;

import com.pojo.ShopCartView;
import com.pojo.sales.SalesOrder;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 销售订单映射器
 *
 * @author admin
 * @date 2023/06/20
 */
public interface SalesOrderMapper {
    /**
     * 添加销售订单
     *
     * @return int
     */
    //添加销售订单表
    int addSalesOrder(SalesOrder salesOrder);

    /**
     * 更新销售订单
     *
     * @param salesOrder 销售订单
     * @return int
     *///根据订单号修改总金额
    int updateSalesOrder(SalesOrder salesOrder);

    /**
     * 按id更新状态
     *
     * @param stateId      状态id
     * @param salesOrderId 销售订单id
     * @return int
     */
    //根据销售订单id修改订单状态
    int updateStatesById(@Param("stateId") Long stateId, @Param("salesOrderId") Long salesOrderId);
    /**
     * 按销售订单号更新状态
     *
     * @param state      状态id
     * @param salesOrderNo 销售订单号
     * @return int
     */
    //根据销售订单id修改订单状态

    int updateStatesByNumber(@Param("state") Long state, @Param("salesOrderNo") String  salesOrderNo);

    /**
     * 查询销售订单
     *
     * @param salesOrderId 销售订单id
     * @return {@link SalesOrder}
     *///根据销售订单查询全部
    SalesOrder QuerySalesOrder(Long salesOrderId);

    /**
     * 通过消费者电话获取商品
     *
     * @return {@link List}<{@link ShopCartView}>
     */
    List<ShopCartView> byConsumerPhoneGetShops(String consumerPhone);

    /**
     * 清空购物车
     *
     * @param consumerPhone 消费者电话
     * @return {@link Integer}
     */
    Integer emptyShopCart(@Param("consumerPhone") String consumerPhone);
}
